package com.learn.springcloud.second.web;

import com.learn.springcloud.second.feign.ClientFeignTestFeign;
import com.learn.springcloud.second.web.model.HandleResult;
import com.learn.springcloud.second.web.model.UserInfoModel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @auth lwt
 * @data 2022/8/24
 */
@Slf4j
@RestController
@RequestMapping(value = "/test/clientFeign/")
public class ClientFeignTestController {

    @Autowired
    private ClientFeignTestFeign clientFeignTestFeign;

    @RequestMapping(value = "/testPost", method = RequestMethod.GET)
    public HandleResult<UserInfoModel> testPost(){
        UserInfoModel userInfoModel=new UserInfoModel();
        userInfoModel.setName("testPost");
        return clientFeignTestFeign.testPost(userInfoModel);
    }

    @RequestMapping(value = "/testGet", method = RequestMethod.GET)
    public HandleResult<UserInfoModel> testGet(){
        UserInfoModel userInfoModel=new UserInfoModel();
        userInfoModel.setName("testGet");
        return clientFeignTestFeign.testGet(userInfoModel);
    }

    @GetMapping(value = "/testPostMapping")
    public HandleResult<UserInfoModel> testPostMapping(){
        UserInfoModel userInfoModel=new UserInfoModel();
        userInfoModel.setName("testPostMapping");
        return clientFeignTestFeign.testPostMapping(userInfoModel);
    }

    @GetMapping(value = "/testGetMapping")
    public HandleResult<UserInfoModel> testGetMapping(){
        UserInfoModel userInfoModel=new UserInfoModel();
        userInfoModel.setName("testGetMapping");
        return clientFeignTestFeign.testGetMapping(userInfoModel);
    }

}
